<template>
	<view class="news">
		<news-item @itemClick="goDetail" :list="newsList"></news-item>
		
	</view>
</template>

<script>
	import newItem from '@/components/new-item.vue'
	export default {
		data() {
			return {
				newsList:[]
				
			}
		},
		methods: {
			async getNews(){
				const res= await this.$myRuquest({
					url:'/api/getnewslist'
				})
				this.newsList=res.data.message
			},
			goDetail(id){
				uni.navigateTo({
					url:'/pages/news-detail/news-detail?id='+id
				})
			}
			
		},
		components:{"news-item":newItem},
		onLoad() {
			this.getNews()
		}
	}
</script>

<style lang="scss">
	.news{
		
	}

</style>
